\(\int \frac {(a+b x) (c+d x)}{(e+f x) (g+h x)} \, dx\) [3]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 25, antiderivative size = 84 \[ \int \frac {(a+b x) (c+d x)}{(e+f x) (g+h x)} \, dx=\frac {b d x}{f h}+\frac {(b e-a f) (d e-c f) \log (e+f x)}{f^2 (f g-e h)}-\frac {(b g-a h) (d g-c h) \log (g+h x)}{h^2 (f g-e h)} \]

[Out]

b*d*x/f/h+(-a*f+b*e)*(-c*f+d*e)*ln(f*x+e)/f^2/(-e*h+f*g)-(-a*h+b*g)*(-c*h+d*g)*ln(h*x+g)/h^2/(-e*h+f*g)

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.040, Rules used = {147} \[ \int \frac {(a+b x) (c+d x)}{(e+f x) (g+h x)} \, dx=\frac {(b e-a f) (d e-c f) \log (e+f x)}{f^2 (f g-e h)}-\frac {(b g-a h) (d g-c h) \log (g+h x)}{h^2 (f g-e h)}+\frac {b d x}{f h} \]

[In]

Int[((a + b*x)*(c + d*x))/((e + f*x)*(g + h*x)),x]

[Out]

(b*d*x)/(f*h) + ((b*e - a*f)*(d*e - c*f)*Log[e + f*x])/(f^2*(f*g - e*h)) - ((b*g - a*h)*(d*g - c*h)*Log[g + h*
x])/(h^2*(f*g - e*h))

Rule 147

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.)*((e_) + (f_.)*(x_))*((g_.) + (h_.)*(x_)), x_Symbol]
:> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x)^n*(e + f*x)*(g + h*x), x], x] /; FreeQ[{a, b, c, d, e, f, g, h},
x] && (IGtQ[m, 0] || IntegersQ[m, n])

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {b d}{f h}+\frac {(-b e+a f) (-d e+c f)}{f (f g-e h) (e+f x)}+\frac {(-b g+a h) (-d g+c h)}{h (-f g+e h) (g+h x)}\right ) \, dx \\ & = \frac {b d x}{f h}+\frac {(b e-a f) (d e-c f) \log (e+f x)}{f^2 (f g-e h)}-\frac {(b g-a h) (d g-c h) \log (g+h x)}{h^2 (f g-e h)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.01 \[ \int \frac {(a+b x) (c+d x)}{(e+f x) (g+h x)} \, dx=\frac {(b e-a f) (d e-c f) h^2 \log (e+f x)+f (b d h (f g-e h) x-f (b g-a h) (d g-c h) \log (g+h x))}{f^2 h^2 (f g-e h)} \]

[In]

Integrate[((a + b*x)*(c + d*x))/((e + f*x)*(g + h*x)),x]

[Out]

((b*e - a*f)*(d*e - c*f)*h^2*Log[e + f*x] + f*(b*d*h*(f*g - e*h)*x - f*(b*g - a*h)*(d*g - c*h)*Log[g + h*x]))/
(f^2*h^2*(f*g - e*h))

Maple [A] (verified)

Time = 1.57 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.21

method result size
default \(\frac {b d x}{f h}+\frac {\left (a c \,h^{2}-a d g h -b c g h +b d \,g^{2}\right ) \ln \left (h x +g \right )}{h^{2} \left (e h -f g \right )}+\frac {\left (-a c \,f^{2}+a d e f +b c e f -b d \,e^{2}\right ) \ln \left (f x +e \right )}{f^{2} \left (e h -f g \right )}\) \(102\)
norman \(\frac {b d x}{f h}+\frac {\left (a c \,h^{2}-a d g h -b c g h +b d \,g^{2}\right ) \ln \left (h x +g \right )}{h^{2} \left (e h -f g \right )}-\frac {\left (a c \,f^{2}-a d e f -b c e f +b d \,e^{2}\right ) \ln \left (f x +e \right )}{\left (e h -f g \right ) f^{2}}\) \(103\)
parallelrisch \(-\frac {\ln \left (f x +e \right ) a c \,f^{2} h^{2}-\ln \left (f x +e \right ) a d e f \,h^{2}-\ln \left (f x +e \right ) b c e f \,h^{2}+\ln \left (f x +e \right ) b d \,e^{2} h^{2}-\ln \left (h x +g \right ) a c \,f^{2} h^{2}+\ln \left (h x +g \right ) a d \,f^{2} g h +\ln \left (h x +g \right ) b c \,f^{2} g h -\ln \left (h x +g \right ) b d \,f^{2} g^{2}-x b d e f \,h^{2}+x b d \,f^{2} g h}{f^{2} h^{2} \left (e h -f g \right )}\) \(159\)
risch \(\frac {b d x}{f h}-\frac {\ln \left (f x +e \right ) a c}{e h -f g}+\frac {\ln \left (f x +e \right ) a d e}{\left (e h -f g \right ) f}+\frac {\ln \left (f x +e \right ) b c e}{\left (e h -f g \right ) f}-\frac {\ln \left (f x +e \right ) b d \,e^{2}}{\left (e h -f g \right ) f^{2}}+\frac {\ln \left (-h x -g \right ) a c}{e h -f g}-\frac {\ln \left (-h x -g \right ) a d g}{h \left (e h -f g \right )}-\frac {\ln \left (-h x -g \right ) b c g}{h \left (e h -f g \right )}+\frac {\ln \left (-h x -g \right ) b d \,g^{2}}{h^{2} \left (e h -f g \right )}\) \(208\)

[In]

int((b*x+a)*(d*x+c)/(f*x+e)/(h*x+g),x,method=_RETURNVERBOSE)

[Out]

b*d*x/f/h+1/h^2*(a*c*h^2-a*d*g*h-b*c*g*h+b*d*g^2)/(e*h-f*g)*ln(h*x+g)+(-a*c*f^2+a*d*e*f+b*c*e*f-b*d*e^2)/f^2/(
e*h-f*g)*ln(f*x+e)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.39 \[ \int \frac {(a+b x) (c+d x)}{(e+f x) (g+h x)} \, dx=\frac {{\left (b d e^{2} + a c f^{2} - {\left (b c + a d\right )} e f\right )} h^{2} \log \left (f x + e\right ) + {\left (b d f^{2} g h - b d e f h^{2}\right )} x - {\left (b d f^{2} g^{2} + a c f^{2} h^{2} - {\left (b c + a d\right )} f^{2} g h\right )} \log \left (h x + g\right )}{f^{3} g h^{2} - e f^{2} h^{3}} \]

[In]

integrate((b*x+a)*(d*x+c)/(f*x+e)/(h*x+g),x, algorithm="fricas")

[Out]

((b*d*e^2 + a*c*f^2 - (b*c + a*d)*e*f)*h^2*log(f*x + e) + (b*d*f^2*g*h - b*d*e*f*h^2)*x - (b*d*f^2*g^2 + a*c*f
^2*h^2 - (b*c + a*d)*f^2*g*h)*log(h*x + g))/(f^3*g*h^2 - e*f^2*h^3)

Sympy [F(-1)]

Timed out. \[ \int \frac {(a+b x) (c+d x)}{(e+f x) (g+h x)} \, dx=\text {Timed out} \]

[In]

integrate((b*x+a)*(d*x+c)/(f*x+e)/(h*x+g),x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.24 \[ \int \frac {(a+b x) (c+d x)}{(e+f x) (g+h x)} \, dx=\frac {b d x}{f h} + \frac {{\left (b d e^{2} + a c f^{2} - {\left (b c + a d\right )} e f\right )} \log \left (f x + e\right )}{f^{3} g - e f^{2} h} - \frac {{\left (b d g^{2} + a c h^{2} - {\left (b c + a d\right )} g h\right )} \log \left (h x + g\right )}{f g h^{2} - e h^{3}} \]

[In]

integrate((b*x+a)*(d*x+c)/(f*x+e)/(h*x+g),x, algorithm="maxima")

[Out]

b*d*x/(f*h) + (b*d*e^2 + a*c*f^2 - (b*c + a*d)*e*f)*log(f*x + e)/(f^3*g - e*f^2*h) - (b*d*g^2 + a*c*h^2 - (b*c
 + a*d)*g*h)*log(h*x + g)/(f*g*h^2 - e*h^3)

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.29 \[ \int \frac {(a+b x) (c+d x)}{(e+f x) (g+h x)} \, dx=\frac {b d x}{f h} + \frac {{\left (b d e^{2} - b c e f - a d e f + a c f^{2}\right )} \log \left ({\left | f x + e \right |}\right )}{f^{3} g - e f^{2} h} - \frac {{\left (b d g^{2} - b c g h - a d g h + a c h^{2}\right )} \log \left ({\left | h x + g \right |}\right )}{f g h^{2} - e h^{3}} \]

[In]

integrate((b*x+a)*(d*x+c)/(f*x+e)/(h*x+g),x, algorithm="giac")

[Out]

b*d*x/(f*h) + (b*d*e^2 - b*c*e*f - a*d*e*f + a*c*f^2)*log(abs(f*x + e))/(f^3*g - e*f^2*h) - (b*d*g^2 - b*c*g*h
 - a*d*g*h + a*c*h^2)*log(abs(h*x + g))/(f*g*h^2 - e*h^3)

Mupad [B] (verification not implemented)

Time = 3.47 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.25 \[ \int \frac {(a+b x) (c+d x)}{(e+f x) (g+h x)} \, dx=\frac {\ln \left (e+f\,x\right )\,\left (a\,c\,f^2-f\,\left (a\,d\,e+b\,c\,e\right )+b\,d\,e^2\right )}{f^3\,g-e\,f^2\,h}+\frac {\ln \left (g+h\,x\right )\,\left (a\,c\,h^2-h\,\left (a\,d\,g+b\,c\,g\right )+b\,d\,g^2\right )}{e\,h^3-f\,g\,h^2}+\frac {b\,d\,x}{f\,h} \]

[In]

int(((a + b*x)*(c + d*x))/((e + f*x)*(g + h*x)),x)

[Out]

(log(e + f*x)*(a*c*f^2 - f*(a*d*e + b*c*e) + b*d*e^2))/(f^3*g - e*f^2*h) + (log(g + h*x)*(a*c*h^2 - h*(a*d*g +
 b*c*g) + b*d*g^2))/(e*h^3 - f*g*h^2) + (b*d*x)/(f*h)